feat: Add delegate filter param's to account_tx RPC - #2827
feat: Add delegate filter param's to account_tx RPC#2827PeterChen13579 wants to merge 19 commits into
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Will wait for Rippled PR to be merged first before merging this one 🫡 |
There was a problem hiding this comment.
Pull request overview
Adds delegation-aware filtering to the account_tx RPC so callers can request only transactions where the queried account participated via sfDelegate (either as the authorizer/owner or as the actor/signer), optionally constrained to a specific counterparty.
Changes:
- Introduces
delegaterequest parameter validation/parsing (delegate_filter+ optionalcounter_party) and threads it intoAccountTxHandler. - Implements
DelegateTransactionFilterto include/exclude transactions based onsfDelegatesemantics and annotates results withauthorizer/actorfor matched delegated txns. - Adds unit test coverage for parsing, validation, filtering behavior, and handler integration.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/rpc/RPCHelpersTests.cpp | Adds unit tests for parseDelegateType / parseDelegateFilter. |
| tests/unit/rpc/handlers/AccountTxTests.cpp | Adds parameter-validation and handler behavior tests for delegate filtering. |
| tests/unit/rpc/filters/impl/DelegateTransactionsFilterTests.cpp | New unit tests for the delegate transaction filter logic. |
| tests/unit/CMakeLists.txt | Registers the new filter test file in the unit test build. |
| tests/common/util/TestObject.hpp | Declares createDelegateBlob test helper. |
| tests/common/util/TestObject.cpp | Implements createDelegateBlob helper to produce delegated tx blobs. |
| tests/common/util/MockBackendTestFixture.hpp | Removes an unused include. |
| src/rpc/RPCHelpers.hpp | Declares delegate parsing helpers. |
| src/rpc/RPCHelpers.cpp | Implements delegate parsing helpers. |
| src/rpc/handlers/AccountTx.hpp | Extends handler input/spec to accept delegate and adds validator. |
| src/rpc/handlers/AccountTx.cpp | Applies delegate filtering in the account_tx loop and adds authorizer/actor output fields (non-binary path). |
| src/rpc/filters/TransactionFilter.hpp | Introduces a filter interface and FilterResult struct. |
| src/rpc/filters/impl/DelegateTransactionsFilter.hpp | Declares DelegateTransactionFilter. |
| src/rpc/filters/impl/DelegateTransactionsFilter.cpp | Implements delegation-based transaction matching. |
| src/rpc/common/Validators.hpp | Declares delegateValidator. |
| src/rpc/common/Validators.cpp | Implements delegate parameter validation (required delegate_filter, optional valid-account counter_party). |
| src/rpc/common/Types.hpp | Adds DelegateFilter request type. |
| src/rpc/CMakeLists.txt | Adds the new filter implementation to the rpc target sources. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
godexsoft
left a comment
There was a problem hiding this comment.
Leaving some small things. Overall PR looks good!
One more thing that you can try to do is to find and remove/simplify comments that are too verbose or unnecessary - i have seen some on the way through this PR.
| @@ -0,0 +1,85 @@ | |||
| //------------------------------------------------------------------------------ | |||
There was a problem hiding this comment.
We no longer add these banners
| @@ -0,0 +1,54 @@ | |||
| //------------------------------------------------------------------------------ | |||
| @@ -0,0 +1,54 @@ | |||
| //------------------------------------------------------------------------------ | |||
| boost::json::value_to<std::string>(jsonObject.at("tx_type")); | ||
| } | ||
|
|
||
| if (jsonObject.contains(JS(delegate))) { |
There was a problem hiding this comment.
nit: Probably can do without the curlies here?
| @@ -0,0 +1,212 @@ | |||
| //------------------------------------------------------------------------------ | |||
There was a problem hiding this comment.
This is also not needed
This PR adds the ability to filter account_tx results based on transaction delegation. This is useful for scenarios where one account (the delegatee) signs and submits a transaction on behalf of another account (the delegator).
New Request Parameter:
Example: If User A submits a transaction to C on behalf of B:
User B (The account holder) can query with delegate_filter: "actor" to find transactions signed by others (like User A).
User A (The signer) can query with delegate_filter: "authorizer" to find transactions they signed for others (like User B).
The counter_party field can be used in either case to filter by a specific valid address